package job.Swing;

import javax.swing.*;
import javax.swing.table.DefaultTableModel;
import java.awt.*;

public class HotelView extends JFrame {
    public JComboBox<String> comboBox;
    public JTable table;
    public DefaultTableModel tableModel;
    public JButton addButton;

    public HotelView() {
        setTitle("酒店入住信息");
        setSize(800, 450);
        setLocationRelativeTo(null);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        comboBox = new JComboBox<>();
        add(comboBox, BorderLayout.NORTH);

        String[] columnNames = {"酒店名称", "酒店地址", "用户姓名", "入住时间", "离开时间"};
        tableModel = new DefaultTableModel(columnNames, 0);
        table = new JTable(tableModel);
        add(new JScrollPane(table), BorderLayout.CENTER);

        JPanel bottomPanel = new JPanel();
        addButton = new JButton("添加运动员");
        bottomPanel.add(addButton);
        add(bottomPanel, BorderLayout.SOUTH);
    }
}
